home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / CD CHIP.ISO / WebServ / folkweb / SIMPLE.PL_ < prev    next >
Encoding:
Text File  |  1995-12-02  |  1.4 KB  |  45 lines

  1. #!/usr/local/bin/perl -- -*- C -*-
  2.  
  3. # $Header: /cys/people/brenner/http/docs/web/RCS/simple-form.cgi,v 1.2 1995/04/07 21:36:57 brenner Exp $
  4. # Copyright (C) 1994 Steven E. Brenner
  5. # This is a small demonstration script to demonstrate the use of 
  6. # the cgi-lib.pl library
  7.  
  8. require "cgi-lib.pl";
  9.  
  10. MAIN:
  11. {
  12. # Read in all the variables set by the form
  13.   &ReadParse(*input);
  14.  
  15. # Print the header
  16.   print &PrintHeader;
  17.   print "<html><head>\n";
  18.   print "<title>cgi-lib.pl demo form output</title>\n";
  19.   print "</head>\n<body>\n";
  20.  
  21. # Do some processing, and print some output
  22.   ($text = $input{'text'}) =~ s/\n/\n<BR>/g; 
  23.                                    # add <BR>'s after carriage returns
  24.                                    # to multline input, since HTML does not
  25.                                    # preserve line breaks
  26.   print <<ENDOFTEXT;
  27.  
  28. <H1>This is the output of simple-form.cgi</H1>
  29.  
  30. You, $input{'name'}, whose favorite color is $input{'color'} are on a
  31. quest which is $input{'quest'}, and are looking for the weight of an
  32. $input{'swallow'} swallow.  And this is what you have to say for
  33. yourself:<P> $text<P>
  34.  
  35. ENDOFTEXT
  36.  
  37.  
  38. # If you want, just print out a list of all of the variables.
  39.   print "<HR>And here is a list of the variables you entered...<P>";
  40.   print &PrintVariables(%input);
  41.  
  42. # Close the document cleanly.
  43.   print "</body></html>\n";
  44. }
  45.